package com.dgd.multidatasource.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dgd.multidatasource.model.mybatis.entity.Order;
import com.dgd.multidatasource.model.mybatis.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author : DaiGD
 * @createtime :  2020年06月13日 19:15
 * @description : 订单服务方法
 */
@Service
public class OrderService  {

    @Autowired
    private OrderMapper orderMapper;

    public Order queryById(long id)
    {
        return orderMapper.selectById(id);
    }

    /*
     //创建lambda 条件构造器 的三种方法
        LambdaQueryWrapper<User> lambda2 = new LambdaQueryWrapper<>();
        LambdaQueryWrapper<User> lambda = new QueryWrapper<User>().lambda();
        LambdaQueryWrapper<User> lambda3 = Wrappers.<User>lambdaQuery();
        lambda3.like(User::getName, "雨").lt(User::getAge, 40);
     */
    public List<Order> selectAll() {
        QueryWrapper<Order> queryWrapper = new QueryWrapper<>();
        queryWrapper.select();
        return orderMapper.selectList(queryWrapper);
    }
}
